package com.witte.serviceImp;

import com.witte.dao.NewCustomerMapper;
import com.witte.entity.Customer;
import com.witte.entity.NewCustomer;
import com.witte.service.NewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewServiceImp implements NewService {

    @Autowired(required=false)
    NewCustomerMapper newCustomerMapper;

    @Override
    public List<NewCustomer> selectAll() {
        List<NewCustomer> newCusInfo = newCustomerMapper.selectAll();
        return newCusInfo;
    }

    @Override
    public List<NewCustomer> getPage(Integer beginPage, Integer pageSize) {
        int begain= (beginPage-1)*pageSize;
        return newCustomerMapper.selectPage(begain,pageSize);
    }

    @Override
    public int deleteByPrimaryKey(Integer customerno) {
        int delectCus = newCustomerMapper.deleteByPrimaryKey(customerno);
        return delectCus;
    }

    @Override
    public List<NewCustomer> getNameList(String name, Integer beginPage, Integer pageSize) {
        int begain = (beginPage-1)*pageSize;
        return newCustomerMapper.selectByName(name,begain,pageSize);
    }

    @Override
    public int getNameCount(String name) {
        return newCustomerMapper.getNameCount(name);
    }

    @Override
    public List<NewCustomer> selectTime() {
        List<NewCustomer> timeInfo = newCustomerMapper.selectTime();
        return timeInfo;
    }

    @Override
    public int updateByChanceNo(NewCustomer newCustomer) {
        int updateCusInfo = newCustomerMapper.updateByPrimaryKey(newCustomer);
        return updateCusInfo;
    }

    @Override
    public int getRecodeCount() {
        return newCustomerMapper.getRecodeCount();
    }

    @Override
    public int updateByPrimaryKeySelective(NewCustomer newCustomer) {
        int updateCusInfo = newCustomerMapper.updateByPrimaryKey(newCustomer);
        return updateCusInfo;
    }

    @Override
    public int insert(NewCustomer newCustomer) {
        int insertCusInfo = newCustomerMapper.insert(newCustomer);
        return insertCusInfo;
    }
}
